package cn.knowei.miaosha.consumer;

import cn.knowei.miaosha.enums.RabbitSt;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Author: knowei
 * @Description:
 * @Date: Create in 19:35 2023-04-07
 */
@Component
@Slf4j
public class DeadLetterQueueConsumer {

    @RabbitListener(queues = RabbitSt.DEAD_LETTER_QUEUE_A_NAME)
    public void receiveA(Message message) {
        String msg = new String(message.getBody());
        log.info("当前时间：{}，死信队列A", msg);
    }

    @RabbitListener(queues = RabbitSt.DEAD_LETTER_QUEUE_B_NAME)
    public void receiveB(Message message) {
        String msg = new String(message.getBody());
        log.info("当前时间：{}，死信队列B", msg);
    }
}
